home *** CD-ROM | disk | FTP | other *** search
/ Risc World 3 / Risc World 3.iso / SOFTWARE / ISSUE3 / SCRIBBLE / Examples / hello < prev    next >
Text File  |  2002-09-04  |  2KB  |  67 lines

  1. --  hello example in Lua
  2.  
  3. verse1 = {
  4.          [[When good king Arthur ruled the land]],
  5.          [[he was a goodly king.]],
  6.          [[He stole three pecks of barley rye]],
  7.          [[to make bag pudding.]] 
  8.         } 
  9.         
  10. verse2 = {
  11.           [[A bag pudding the king did make]],
  12.           [[and stuffed it full of plums,]],
  13.           [[and in it put great lumps of fat]],
  14.           [[as big as my two thumbs.]]
  15.          } 
  16.          
  17. verse3 = {
  18.           [[The king and queen did eat thereof]],
  19.           [[and noblemen beside,]],
  20.           [[and what they could not eat that night]],
  21.           [[the queen next morning fried.]]
  22.          } 
  23.                       
  24. x = BEGIN(arg[1].."_pdf")
  25.  
  26. x.red =  function (self)
  27.             return self:setcolor("both","rgb",1,0,0,0)
  28.           end -- function
  29.  
  30. x.green = function (self)
  31.             return self:setcolor("both","rgb",0,1,0,0)
  32.           end -- function
  33.           
  34. x.blue =  function (self)
  35.             return self:setcolor("both","rgb",0,0,1,0)
  36.           end -- function  
  37.  
  38. x.showlines = function (self,t)
  39.                self:show("")
  40.                for i = 1,getn(t) do
  41.                  self:continue_text(t[i])
  42.                end -- for
  43.               end -- function   
  44.  
  45. x:set_info("Creator","hello")
  46. x:set_info("Author","GCW")
  47. x:set_info("Title","Hello there")
  48.  
  49. x:begin_page(A4.width,A4.height)
  50.  
  51. icon = x:open_image_file("jpeg",arg[1].."_jpg","",0)
  52. x:place_image(icon,80,700,1)
  53. x:close_image(icon)
  54.  
  55. font = x:findfont("Times-Roman", "host", 0)
  56. x:setfont(font, 14)
  57. x:set_text_pos(80, 680)
  58. x:red()
  59. x:showlines(verse1)
  60. x:green()
  61. x:continue_text(" ")
  62. x:showlines(verse2)
  63. x:blue()
  64. x:continue_text(" ")
  65. x:showlines(verse3)
  66.  
  67. x:END()